home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 9
/
Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO
/
054a
/
cismnav.zip
/
CISMNAV.WAS
< prev
next >
Wrap
Text File
|
1993-02-19
|
8KB
|
179 lines
;******************************************************************************
;* SCRIPT: CISMNAV.WAS
;* AUTHOR: Philip Troiano
;* Date: 3/1/93
;* Cis #: 76046,2003
;*
;* Purpose: To download CIS data directly into an Excel spread sheet.
;* This script is called by an Excel Macro. It takes a list of ticker
;* symbols from an Excel spreadsheet (mthlynav.xls) and feeds them to
;* CompuServe's MQINT interface. It takes the data received and writes it
;* to another spreadsheet (tempdata.xls).
;*
;* The Excel macro then takes the data, parses it, calculates min & end of
;* month NAV's and then fills in my monthly price summary sheet.
;*
;* It should have been uploaded with a copy of the associated Excel Macro
;* CISMNAV.XLM.
;*
;* If any can use any part of this, GOOD! If it even helps someone think of
;* a different solution to one of their problems, thats even better.
;*
;* Replace the xxxxxxxxx at the end of the logon script with password and
;* user ID. The log on script looks for "compuserve" in the Prowin Dialing
;* Directory, so make sure you have created an entry with that string in the
;* NAME field.
;*
;*;******************************************************************************
long ddechan = 0
long ddechan1 = 0
long ddemacr = 0
string cellref
string echocr
string echodata
string mds
string pokecellref
string returndata
string ticksymb
string transtickstring
PROC MAIN
set aspect rxdata off
call XCL_LINK
call LOGON_MQINT
call TRANSMIT_DATA
pause 10
ddeterminate ddechan ;terminates link to mthlynav.xls
ddeterminate ddechan1 ;terminates link to tempdata.xls
activatewin "Microsoft Excel - TEMPDATA.XLS" ;activates excel
sendkey CTRL 0x5A ;sends ctrl-z to activate CisMAcroEnd
ddeterminate ddemacr ;terminates link to cismnav.xlm
endproc
;---------------------------------------------------------------------------------------
PROC XCL_LINK
ddeinit ddechan "excel" "[newmutnv.xlw]mthlynav.xls" ; Try to initiate DDE link with xcl sheet
if ddechan == 0 ; If no link established
usermsg "Unable to establish a link to Mthlynav.xls"
endif
ddeinit ddechan1 "excel" "tempdata.xls" ; Try to initiate DDE link with xcl sheet
if ddechan1 == 0 ; If no link established
usermsg "Unable to establish a link to Tempdata.xls"
endif
ddeinit ddemacr "excel" "[newmutnv.xlw]cismnav.xlm" ; Try to initiate DDE link with xcl macro
if ddemacr == 0 ; If no link established
usermsg "Unable to establish a link to cismnav.xlm"
endif
dderequest ddemacr "monthdatastring" mds ;requests the requested months data string
strcpy mds mds 16 ;strips trailing characters from the mds var
endproc
;---------------------------------------------------------------------------------------
PROC TRANSMIT_DATA
i0=2 ; first row of data is row 3 so set to 2 to increment
i3=0 ;sets row counter for the ddepoke cellref
GETNEWSYMBOL:
i0++
i3++
strfmt cellref "R%iC4" i0 ;forms the string to get the cell with the next ticker
dderequest ddechan cellref s0 ;gets serial ticker symbols
strlen s0 i1 ;gets the length of the returned text(5 letters got 7)
i2=i1-2 ;the difference in the actual letters and recv'd data
strcpy ticksymb s0 i2 ;puts only tick symbols into variable
strfmt transtickstring "%s%s^M" ticksymb mds ;formats the trasmit string
s2 = "cont" ;tests for cont. and jumps script to the index symbols
strcmpi s0 s2 4 ;compares the xcl cell less CR to "END : quits if true
if success
i3--
goto GETNEWSYMBOL
endif
s1 = "END" ;tests for the end of the ticker symbol column
strcmpi s0 s1 3 ;compares the xcl cell less CR to "END : quits if true
if success
goto LASTSYMBOL
else
waitfor ":" 2
transmit transtickstring
statmsg "transmitstring=%s" transtickstring
set aspect rxdata on ; tells script to process incoming data
rget echodata ;captures the echoed transmit string
rget echocr 1 ; captures an echoed CR
rget returndata ;captures the incoming price data
strfmt pokecellref "R%iC1" i3 ; formats the next xcl cellref for ticker symbols
ddepoke ddechan1 pokecellref ticksymb ;writes the ticker symbols to xcl
strfmt pokecellref "R%iC2" i3 ; formats the next xcl cellref
ddepoke ddechan1 pokecellref returndata ;writes the contents of rtd to xcl
statmsg "Data for %s is %s" ticksymb returndata
set aspect rxdata off
if not success
usermsg "ddepoke not successful"
goto LASTSYMBOL
else
endif
goto GETNEWSYMBOL
endif
LASTSYMBOL:
transmit "^M" ;logs off MQINT and CIS
waitfor "Interface:"
transmit "^M"
waitfor "!"
transmit "Bye ^M"
endproc
;---------------------------------------------------------------------------------------
proc LOGON_MQINT
integer ent
while $TXCOUNT
endwhile
if ! $FROMDDIR
set terminal type 25
set port parity even
set port databits 7
set port stopbits 1
set protocol CISB
dialfind "CompuServe" ent
if found
dial ent
else
usermsg "CompuServe not found in this dialing directory"
endif
endif
while $DIALING
endwhile
pause 1
if $CARRIER
transmit "^C"
waitfor "User ID:" 15
transmit "xxxxxxxxxxx"
transmit "^M"
waitfor "Password:" 15
transmit xxxxxxxxxxx"
transmit "^M"
waitfor "!" 60
set terminal enquiry cisb
endif
transmit "GO MQINT ^M" ; MQINT accessed in this next section
waitfor "Interface:" 20
pause 1
transmit "200 ^M" ; accesses Interface 200
endproc
;---------------------------------------------------------------------------------------